<template>
  <div class="collect-page">
    <van-nav-bar
      class="collectTop"
      title="房屋管理"
      left-arrow
      @click-left="onClickLeft"
    />
    <van-list
    v-model="loading"
      :finished="finished"
     finished-text="没有更多了"
      @load="onLoad">
      <RentItem v-for="(item,index) in list" :key="index" :item="item"></RentItem>
    </van-list>
  </div>
</template>

<script>
import RentItem from '@/components/RentItem.vue'
import { getRentList } from '@/api/rentinfo'
export default {
  components: { RentItem },
  name: 'collect-page',
  data () {
    return {
      list: [],
      loading: false,
      finished: false
    }
  },
  methods: {
    async onLoad () {
      const res = await getRentList({})
      console.log(res.body)
      this.list = res.body
      this.loading = false
      this.finished = true
    },
    onClickLeft () {
      this.$router.back()
    }
  }
}
</script>

<style lang="less" scoped>
.collectTop {
  background-color: #1cb676;
}
</style>
